.class public Lcom/zuiapps/suite/utils/device/BrightnessUtil;
.super Ljava/lang/Object;
.source "BrightnessUtil.java"


# instance fields
.field private mContext:Landroid/content/Context;

.field private mPowerManager:Landroid/os/PowerManager;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .registers 3
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    .line 17
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 18
    iput-object p1, p0, Lcom/zuiapps/suite/utils/device/BrightnessUtil;->mContext:Landroid/content/Context;

    .line 19
    const-string v0, "power"

    invoke-virtual {p1, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/os/PowerManager;

    iput-object v0, p0, Lcom/zuiapps/suite/utils/device/BrightnessUtil;->mPowerManager:Landroid/os/PowerManager;

    .line 20
    return-void
.end method


# virtual methods
.method public getAutoBrightness()I
    .registers 4

    .prologue
    .line 34
    :try_start_0
    iget-object v1, p0, Lcom/zuiapps/suite/utils/device/BrightnessUtil;->mContext:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    const-string v2, "screen_brightness_mode"

    invoke-static {v1, v2}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;)I
    :try_end_b
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_b} :catch_d

    move-result v1

    .line 38
    :goto_c
    return v1

    .line 35
    :catch_d
    move-exception v0

    .line 36
    .local v0, "e":Ljava/lang/Exception;
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    .line 38
    const/4 v1, 0x0

    goto :goto_c
.end method

.method public getScreenLightValue()I
    .registers 6

    .prologue
    const/4 v1, 0x0

    .line 50
    :try_start_1
    iget-object v2, p0, Lcom/zuiapps/suite/utils/device/BrightnessUtil;->mContext:Landroid/content/Context;

    invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v2

    const-string v3, "screen_brightness"

    const/4 v4, 0x0

    invoke-static {v2, v3, v4}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I
    :try_end_d
    .catch Ljava/lang/Throwable; {:try_start_1 .. :try_end_d} :catch_f

    move-result v1

    .line 55
    :goto_e
    return v1

    .line 51
    :catch_f
    move-exception v0

    .line 52
    .local v0, "t":Ljava/lang/Throwable;
    invoke-virtual {v0}, Ljava/lang/Throwable;->printStackTrace()V

    goto :goto_e
.end method

.method public setScreenLightValue(I)V
    .registers 5
    .param p1, "value"    # I

    .prologue
    .line 42
    const-string v1, "screen_brightness"

    invoke-static {v1}, Landroid/provider/Settings$System;->getUriFor(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v0

    .line 43
    .local v0, "uri":Landroid/net/Uri;
    iget-object v1, p0, Lcom/zuiapps/suite/utils/device/BrightnessUtil;->mContext:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    const-string v2, "screen_brightness"

    invoke-static {v1, v2, p1}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    .line 45
    iget-object v1, p0, Lcom/zuiapps/suite/utils/device/BrightnessUtil;->mContext:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    const/4 v2, 0x0

    invoke-virtual {v1, v0, v2}, Landroid/content/ContentResolver;->notifyChange(Landroid/net/Uri;Landroid/database/ContentObserver;)V

    .line 46
    return-void
.end method

.method public startAutoBrightness()Z
    .registers 4

    .prologue
    .line 24
    iget-object v0, p0, Lcom/zuiapps/suite/utils/device/BrightnessUtil;->mContext:Landroid/content/Context;

    invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    const-string v1, "screen_brightness_mode"

    const/4 v2, 0x1

    invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    move-result v0

    return v0
.end method

.method public stopAutoBrightness()Z
    .registers 4

    .prologue
    .line 29
    iget-object v0, p0, Lcom/zuiapps/suite/utils/device/BrightnessUtil;->mContext:Landroid/content/Context;

    invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v0

    const-string v1, "screen_brightness_mode"

    const/4 v2, 0x0

    invoke-static {v0, v1, v2}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

    move-result v0

    return v0
.end method
